package com.weixinli.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import com.weixinli.beans.UserGet;
import com.weixinli.dao.IUserGetDao;
@Repository("iUserGetDao")
public class UserGetDaoImpl implements IUserGetDao {
	private SqlSession sqlSession;
	public int addUserGet(Integer w_uid, Integer area_id, String gid) {
		Map <String,Object> map=new HashMap<String, Object>();
		map.put("w_uid",w_uid);
		map.put("area_id", area_id);
		map.put("gid", gid);
		return sqlSession.insert("addUserGet",map);
	}

	public int delUserGet(Integer w_uid, Integer area_id) {
		Map <String,Object> map=new HashMap<String, Object>();
		map.put("w_uid",w_uid);
		map.put("area_id", area_id);
		return sqlSession.delete("delUserGet",map);
	}

	public int addGet(Integer w_uid, String gid, Integer area_id) {
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("w_uid", w_uid);
		map.put("gid", gid);
		map.put("area_id", area_id);
		return sqlSession.insert("addGet", map);
	}

	public int updateGet(Integer w_uid, String gid, Integer area_id) {
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("w_uid", w_uid);
		map.put("gid", gid);
		map.put("area_id", area_id);
		return sqlSession.update("updateGet", map);
	}
	
	public List<UserGet> getPageUserGet(Integer pageNo, Integer pageSize) {
		// TODO Auto-generated method stub
		return null;
	}

	public int getTotalUserGet(Integer w_uid) {
		// TODO Auto-generated method stub
		return 0;
	}

	public String findUserGet(Integer w_uid, Integer area_id) {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("w_uid", w_uid);
		map.put("area_id", area_id);
		return sqlSession.selectOne("findUserGet",map);
	}

	public List<UserGet> findOnes(Integer w_uid) {
		// TODO Auto-generated method stub
		return null;
	}
	@Resource(name="sqlSession")
	public void setSqlSession(SqlSession sqlSession) {
		this.sqlSession = sqlSession;
	}
}
